package cn.bluethink.eguan.rewardtask.entity;

import java.io.Serializable;
import java.util.Date;

import org.springframework.beans.BeanUtils;

import cn.bluethink.eguan.model.core.EgOType;
import cn.bluethink.eguan.model.core.EgObject;
import cn.bluethink.eguan.model.core.EgTask;
import cn.bluethink.eguan.model.core.EgUser;
import cn.bluethink.eguan.model.rewardtask.EgRewardTask;

/**
 * 悬赏任务+通用任务 联合查询返回结果实体
 * 
 * @author 苏州中科蓝迪公司所有(c)2016-2021
 * @version 0.1.0
 * @note 修订历史： 1、wanglei于2018/10/19设计并构建初始版本v0.1.0
 */
public class RewardTaskEntity implements Serializable {

    private static final long serialVersionUID = -8082972463507183419L;

    private Long tid;

    // 任务类型（悬赏任务）
    private Integer otype;

    private String name;

    private String content;

    private Integer status;

    // 发布悬赏任务的位置对象类型
    private Integer posOtype;

    // 位置对象的ID
    private Long posOid;

    // 任务的开始时间
    private Date btime;

    // 任务的更新时间
    private Date utime;

    // 截至时间
    private Date etime;

    // 最终完成时间
    private Date ftime;

    // 任务发布者
    private Long cuid;

    // 发布者名称
    private String uname;

    // 发布者头像
    private String avator;

    private Integer checkStatus;

    /**
     * 悬赏任务字段
     */
    // bt币
    private Integer btCoin;

    // 限制领取任务的人数，为0代表无限制
    private Integer limitNum;

    // 接受者计数
    private Integer rvCount;

    // 接受者累计赏金数
    private Integer rvBtCoin;

    // 个人或团队悬赏标识（true为个人，默认为团队）
    private Boolean bmine;

    public RewardTaskEntity() {

    }

    public EgRewardTask createRewardTask() {

        EgTask task = new EgTask(tid, name, content, new EgOType(otype, null));
        task.setStatus(status);
        task.setPos(new EgObject(posOid, null, new EgOType(posOtype, null)));
        task.setBtime(btime);
        task.setUtime(utime);
        task.setEtime(etime);
        task.setFtime(ftime);
        task.setCuser(new EgUser(cuid, uname, avator));
        task.setCheckStatus(checkStatus);

        EgRewardTask rewardTask = new EgRewardTask(tid, null, null);
        BeanUtils.copyProperties(task, rewardTask);
        rewardTask.setBtCoin(btCoin);
        rewardTask.setLimit(limitNum);
        rewardTask.setRvcount(rvCount);
        rewardTask.setRvBtCoin(rvBtCoin);
        rewardTask.setBmine(bmine);
        return rewardTask;
    }

    public Long getTid() {
        return tid;
    }

    public void setTid(Long tid) {
        this.tid = tid;
    }

    public Integer getOtype() {
        return otype;
    }

    public void setOtype(Integer otype) {
        this.otype = otype;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAvator() {
        return avator;
    }

    public void setAvator(String avator) {
        this.avator = avator;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getPosOtype() {
        return posOtype;
    }

    public void setPosOtype(Integer posOtype) {
        this.posOtype = posOtype;
    }

    public Long getPosOid() {
        return posOid;
    }

    public void setPosOid(Long posOid) {
        this.posOid = posOid;
    }

    public Date getBtime() {
        return btime;
    }

    public void setBtime(Date btime) {
        this.btime = btime;
    }

    public Date getUtime() {
        return utime;
    }

    public void setUtime(Date utime) {
        this.utime = utime;
    }

    public Date getEtime() {
        return etime;
    }

    public void setEtime(Date etime) {
        this.etime = etime;
    }

    public Date getFtime() {
        return ftime;
    }

    public void setFtime(Date ftime) {
        this.ftime = ftime;
    }

    public Long getCuid() {
        return cuid;
    }

    public void setCuid(Long cuid) {
        this.cuid = cuid;
    }

    public String getUname() {
        return uname;
    }

    public void setUname(String uname) {
        this.uname = uname;
    }

    public Integer getCheckStatus() {
        return checkStatus;
    }

    public void setCheckStatus(Integer checkStatus) {
        this.checkStatus = checkStatus;
    }

    public Integer getBtCoin() {
        return btCoin;
    }

    public void setBtCoin(Integer btCoin) {
        this.btCoin = btCoin;
    }

    public Integer getLimitNum() {
        return limitNum;
    }

    public void setLimitNum(Integer limitNum) {
        this.limitNum = limitNum;
    }

    public Integer getRvCount() {
        return rvCount;
    }

    public void setRvCount(Integer rvCount) {
        this.rvCount = rvCount;
    }

    public Integer getRvBtCoin() {
        return rvBtCoin;
    }

    public void setRvBtCoin(Integer rvBtCoin) {
        this.rvBtCoin = rvBtCoin;
    }

    public Boolean getBmine() {
        return bmine;
    }

    public void setBmine(Boolean bmine) {
        this.bmine = bmine;
    }
}
